<a role="button" ng-click="editObject(0)" data-toggle="modal" data-target="#myModal" class="btn btn-primary r ml5" >新建属性</a>
<a role="button" ng-click="editObject(1)" data-toggle="modal" data-target="#myModal" class="btn btn-primary r" >新建属性组</a>


<div class="fix">
<div class="mt10" ng-repeat="p in models" ng-if="p.type=='1' ">
    <div>
    <label>属性组名:</label>
        <p class="dib" ng-bind="p.name"></p>
        <a class=" btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal"  ng-click="editObject(1, p)" data-toggle="modal" data-target="#myModal"><span
        class="glyphicon glyphicon-pencil"></span></a>
        <a class="btn btn-danger btn-xs"  data-nodrag ng-click="delete(p)" style="margin-left: 8px;"><span
                class="glyphicon glyphicon-remove"></span></a>
    </div>


    <p>下属属性:</p>
    <div class="ml10" ng-repeat="m in models" ng-if=" m.pid==p.objectId">
        <p class="dib" ng-bind="m.name"></p> <a class=" btn btn-primary btn-xs" ng-click="editObject(0,m)" data-toggle="modal" data-target="#myModal"><span
            class="glyphicon glyphicon-pencil"></span></a>
        <a class=" btn btn-danger btn-xs"  data-nodrag ng-click="delete(m)" style="margin-left: 8px;"><span
                class="glyphicon glyphicon-remove"></span></a>
    </div>
</div>

    <div class="mt10">
        <label>其他属性:</label>
        <div ng-repeat="p in models" ng-if="p.type=='0' && p.pid=='0' ">
            <p class="dib" ng-bind="p.name"></p>
            <a class=" btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal"  ng-click="editObject(0, p)" data-toggle="modal" data-target="#myModal"><span
                    class="glyphicon glyphicon-pencil"></span></a>
            <a class=" btn btn-danger btn-xs"  data-nodrag ng-click="delete(p)" style="margin-left: 8px;"><span
                    class="glyphicon glyphicon-remove"></span></a>
        </div>

    </div>


</div>


<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button"
                        class="close"
                        data-dismiss="modal"
                        aria-hidden="true">x</button>
                <h3 id="userMgrLabel">编辑{{editType}}</h3>
            </div>
            <div class="modal-body">

                <form name="userForm" class="form-horizontal" novalidate role="form">
                    <div class="form-group" show-errors>
                        <label class="col-sm-2 control-label">{{editType}}名</label>
                        <div class="col-sm-10">
                            <input type="text" ng-model="editProperty.name" name="name" class="form-control" required>
                            <p class="help-block" ng-if="userForm.name.$error.required">必填</p>
                        </div>
                    </div>

                    <div class="form-group" ng-if="editProperty.type == 0">
                        <label class="col-sm-2 control-label">属性组</label>
                        <div class="col-sm-10">
                            <select ng-model="editProperty.pid" class="form-control" >
                                <option value="0">不选</option>
                                 <option ng-repeat="p in models" ng-selected="editProperty.pid &&p.objectId==editProperty.pid" ng-if="p.type==1" value ={{p.objectId}}>{{p.name}}</option>
                            </select>
                        </div>
                    </div>


                </form>

            </div>

            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-primary"
                        data-dismiss="modal"
                        aria-hidden="true"
                        ng-click="save(editProperty)"
                        >保存</button>
            </div>
        </div>
    </div>
</div>




